package cn.edu.wynu.encapsulation;

public class Student {
    // private 私有化属性，对外隐藏
    // private double score;
    private double score;

    public void setScore(double score){
        if(score >= 0 && score <= 100){
            this.score = score;
        }else{
            System.out.println("成绩不合法");
        }
    }

    public double getScore(){
        return score;
    }

    public void printPass(){
        System.out.println(score >= 60 ? "及格" : "不及格");
    }
}
